package com.team.wy;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.team.arms.SmartArmsApplication8081;
import com.team.arms.bingyiInfo.entity.BingyiInfo;
import com.team.arms.bingyiInfo.mapper.BingyiInfoMapper;
import com.team.arms.bingyiInfo.service.IBingyiInfoService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @author: WY
 * @date: 2022/5/8
 */
@SpringBootTest(classes = SmartArmsApplication8081.class)
public class testBingyi {
    @Autowired
    BingyiInfoMapper bingyiInfoMapper;

    @Autowired
    IBingyiInfoService iBingyiInfoService;

    @Test
    public void testSelectPoliticalStatus(){
        String s = iBingyiInfoService.selectPoliticalStatusByBingyiId("1522137470781698050");
        System.out.println(s);
    }

    @Test
    public void testOrAnd(){
        QueryWrapper<BingyiInfo> queryWrapperBingyi=new QueryWrapper<>();
        queryWrapperBingyi.lambda()
                .like(BingyiInfo::getIdCard,"666")
                .or(wp->wp.eq(BingyiInfo::getName,"叶修")).eq(BingyiInfo::getAge,"18");

        List<BingyiInfo> bingyiInfos = bingyiInfoMapper.selectList(queryWrapperBingyi);
        bingyiInfos.forEach(System.out::println);
    }

    @Test
    public  void notInSql(){
        QueryWrapper<BingyiInfo> queryWrapperBingyi=new QueryWrapper<>();
        queryWrapperBingyi.lambda()
                .eq(BingyiInfo::getName,"天乐")
                .or(wp->wp.eq(BingyiInfo::getIdCard,"666")).notIn(BingyiInfo::getAge,"18");
        List<BingyiInfo> bingyiInfos = bingyiInfoMapper.selectList(queryWrapperBingyi);
        bingyiInfos.forEach(System.out::println);

    }
}
